import '../index.dart';

class HomePageRoute extends StatefulWidget {
  @override
  _HomePageRoutee createState() => _HomePageRoutee();
}

class _HomePageRoutee extends State<HomePageRoute> {
  @override
  void initState() {
    super.initState();
  }

  int _index = 0;
  var item = ['分类','网站','我的'];

  Widget view_in (){
    if (_index == 0){
        return CatgaryRoute();
    }else if(_index == 1){
        return BookMarksRoute();
    }else if(_index == 2){
        return MineRoute();
    }
  }

  Widget build(BuildContext context) {

    return Scaffold(
        appBar: AppBar(
          title: Text(item[_index]),
        ),
        body: Container(
          child: view_in(),
        ),
        bottomNavigationBar: BottomNavigationBar(
            onTap: (tappedItemIndex) =>
                setState(() {
                  _index = tappedItemIndex;
                }),
            currentIndex: _index,
            items: [
              BottomNavigationBarItem(
                  icon: Icon(Icons.dock), title: Text(item[0])),
              BottomNavigationBarItem(
                  icon: Icon(Icons.bookmark), title: Text(item[1])),
              BottomNavigationBarItem(
                  icon: Icon(Icons.person), title: Text(item[2]))
            ])
    );
  }
}